package com.cheejee.goodscenter.module.entity;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
public class CategoryPropertiesTemplate {
	@NotNull(message = "分类属性模板id不能为空", groups = UpdateGroup.class)
    private Integer id;

	@NotNull(message = "分类属性模板所属的分类id不能为空", groups = {InsertGroup.class,UpdateGroup.class})
    private Integer categoryId;

	@NotNull(message = "分类属性模板所属的分组id不能为空", groups = {InsertGroup.class,UpdateGroup.class})
    private Integer categoryPropertiesGroupId;

    @NotNull(message = "分类属性模板名称不能为空", groups = {InsertGroup.class,UpdateGroup.class})
    @Length(max = 200, message = "分类属性模板名称长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
    private String propertiesName;

    private boolean required;

    @NotNull(message = "分类属性模板类型不能为空", groups = {InsertGroup.class,UpdateGroup.class})
    private Byte type;

    private String initial;

    private String describe;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public Integer getCategoryPropertiesGroupId() {
        return categoryPropertiesGroupId;
    }

    public void setCategoryPropertiesGroupId(Integer categoryPropertiesGroupId) {
        this.categoryPropertiesGroupId = categoryPropertiesGroupId;
    }

    public String getPropertiesName() {
        return propertiesName;
    }

    public void setPropertiesName(String propertiesName) {
        this.propertiesName = propertiesName == null ? null : propertiesName.trim();
    }

    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Byte getType() {
        return type;
    }

    public void setType(Byte type) {
        this.type = type;
    }

    public String getInitial() {
        return initial;
    }

    public void setInitial(String initial) {
        this.initial = initial == null ? null : initial.trim();
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe == null ? null : describe.trim();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", categoryPropertiesGroupId=").append(categoryPropertiesGroupId);
        sb.append(", propertiesName=").append(propertiesName);
        sb.append(", required=").append(required);
        sb.append(", type=").append(type);
        sb.append(", initial=").append(initial);
        sb.append(", describe=").append(describe);
        sb.append("]");
        return sb.toString();
    }
}